<!DOCTYPE html>

<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>设备连接页面</title>
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<style>
	form *{
		padding:10px;
	}
	
</style>
<body>
	<div class="container">
		<div class="row">
			<h3>设备连接页面</h3>
		 </div>
		 <div class="row">
		 	<div class="col-sm-12"><button onclick="scan()" class="btn btn-primary">扫描以获取检测数据</button></div>
		 </div>
		  <div class="row" style="display:none">
			  	<div class="row">TICKET:${jsapi_ticket}</div>
			 <div class="row">NONCE:${noncestr}</div>
			  <div class="row">TIMESTAMP:${timestamp}</div>
			  <div class="row">URL:${url}</div>
			  <div class="row">SIG:${signature}</div>  
		  </div>
		  	<p>控烟数据:</p>
			<div class="row" id="lbInfo"></div>
	</div>
</body>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script>
	!function(w){
		
		wx.config({
			  beta:true,
		    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
		    appId: 'wxdb110e9fbff9b21d', // 必填，公众号的唯一标识
		    timestamp: '${timestamp}', // 必填，生成签名的时间戳
		    nonceStr: '${noncestr}', // 必填，生成签名的随机串
		    signature: '${signature}',// 必填，签名，见附录1
		    jsApiList: ['getNetworkType','scanQRCode']
		});
		wx.ready(function(){
			
		});
		wx.error(function(res){
			alert(res);
		});
	}(window)
	function scan(){
		wx.scanQRCode({
			needResult:1,
			scanType:['qrCode','barCode'],
			success:function(res){
				$("#lbInfo").html(res.resultStr);
			},
			fail:function(res){
				$("#lbInfo").html(res);
			}
			
		});
	}
</script>
</html>